<?php if (!defined('THINK_PATH')) exit(); /*a:1:{s:71:"D:\phpStudy\WWW\thinkphp5\public/../app1/index\view\index\postlist.html";i:1488968959;}*/ ?>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
</head>

<body>
	<div>
	    <!-- <span><?php echo $user['user_name']; ?></span> -->
		<?php if($user == null): ?> <input type="button"
			onclick="show('loginPage')" id="login" value="登录" /> 
		<?php else: ?> <input type="button" onclick="quit()" id="quit" value="退出" />
		         &nbsp;&nbsp;用户名:<span><?php echo $user['user_name']; ?></span>
		<?php endif; ?>
		&nbsp;&nbsp;<input type="button" onclick="show('post')" value="发帖">
	</div>
	<div>
		<table border="1" style="border-collapse: collapse;">
			<tr>
				<th>id</th>
				<th>title</th>
				<th>user_id</th>
				<th>create_time</th>
			</tr>
			<?php if(is_array($list) || $list instanceof \think\Collection): $i = 0; $__LIST__ = $list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$post): $mod = ($i % 2 );++$i;?>
			<tr>
				<td><?php echo $post['id']; ?></td>
				<td><a href="<?php echo url('/index/index/postdetail'); ?>?id=<?php echo $post['id']; ?>"><?php echo $post['title']; ?></a></td>
				<td><?php echo $post['user_id']; ?></td>
				<td><?php echo $post['create_time']; ?></td>
			</tr>
			<?php endforeach; endif; else: echo "" ;endif; ?>
		</table>
	</div>
	<?php echo $list->render(); ?>
	<div id="loginPage" style="display:none">
		用户:<input type="text" name="user_name" id="user_name" placeholder="user_name" /><br />  
		密码:<input type="password" name="user_password" id="user_password" placeholder="user_password" /><br />
		     <input type="button" onclick="login()" value="登录" /><input type="button" onclick="state()" value="注册">
	</div>
	
	<div id="regist" style="display:none">
		用户:<input type="text" name="user_name" id="registuser_name" placeholder="user_name" /><br /> 
		密码:<input type="password" name="user_password" id="registuser_password" placeholder="user_password" /><br />
		     <input type="button" onclick="regist()" value="确认" />
	</div>
	
	<div id="post" style="display:none">
		        <input type="hidden" name="user_id" id="user_id" value="<?php echo $user['id']; ?>" /><br /> 
		        <input type="hidden" name="create_time" id="create_time"
			      value="<?php echo date('Y-m-d H:i:s',time()); ?>" /><br />
		       标题:<input type="text" name="title" id="title" value="" /><br /> 
		       内容:<input type="text" name="content" id="content" value="" /><br />     
			    <input type="button" onclick="post()" name="complete" value="完成" /><br />
	</div>
<script src="/js/postlist.js"></script>
<div id="reply"></div>
</body>
</html>